package com.qst.util;

import java.util.Random;

/**
 *随机生成num位数
 */
public class RandomNum {

    private static String randString = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";//随机产生数字与字母组合的字符串

    public static String createNumRandom(Integer num){
        String temp = "";
        Random random = new Random();
        for(int i=0; i<num; i++){
            int number = random.nextInt(randString.length());
            char c = randString.charAt(number);
            temp += c;
        }
        System.out.println("生成的随机数:"+temp);
        return temp;
    }
}
